1 /*
2  * This file is part of gtkD.
3  *
4  * gtkD is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License
6  * as published by the Free Software Foundation; either version 3
7  * of the License, or (at your option) any later version, with
8  * some exceptions, please read the COPYING file.
9  *
10  * gtkD is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with gtkD; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
18  */
19 
20 // generated automatically - do not change
21 // find conversion definition on APILookup.txt
22 // implement new conversion functionalities on the wrap.utils pakage
23 
24 
25 module gtk.StackSwitcher;
26 
27 private import glib.ConstructionException;
28 private import gobject.ObjectG;
29 private import gtk.OrientableIF;
30 private import gtk.OrientableT;
31 private import gtk.Stack;
32 private import gtk.Widget;
33 private import gtk.c.functions;
34 public  import gtk.c.types;
35 
36 
37 /**
38  * The `GtkStackSwitcher` shows a row of buttons to switch between `GtkStack`
39  * pages.
40  * 
41  * ![An example GtkStackSwitcher](stackswitcher.png)
42  * 
43  * It acts as a controller for the associated `GtkStack`.
44  * 
45  * All the content for the buttons comes from the properties of the stacks
46  * [class@Gtk.StackPage] objects; the button visibility in a `GtkStackSwitcher`
47  * widget is controlled by the visibility of the child in the `GtkStack`.
48  * 
49  * It is possible to associate multiple `GtkStackSwitcher` widgets
50  * with the same `GtkStack` widget.
51  * 
52  * # CSS nodes
53  * 
54  * `GtkStackSwitcher` has a single CSS node named stackswitcher and
55  * style class .stack-switcher.
56  * 
57  * When circumstances require it, `GtkStackSwitcher` adds the
58  * .needs-attention style class to the widgets representing the
59  * stack pages.
60  * 
61  * # Accessibility
62  * 
63  * `GtkStackSwitcher` uses the %GTK_ACCESSIBLE_ROLE_TAB_LIST role
64  * and uses the %GTK_ACCESSIBLE_ROLE_TAB for its buttons.
65  * 
66  * # Orientable
67  * 
68  * Since GTK 4.4, `GtkStackSwitcher` implements `GtkOrientable` allowing
69  * the stack switcher to be made vertical with
70  * `gtk_orientable_set_orientation()`.
71  */
72 public class StackSwitcher : Widget, OrientableIF
73 {
74 	/** the main Gtk struct */
75 	protected GtkStackSwitcher* gtkStackSwitcher;
76 
77 	/** Get the main Gtk struct */
78 	public GtkStackSwitcher* getStackSwitcherStruct(bool transferOwnership = false)
79 	{
80 		if (transferOwnership)
81 			ownedRef = false;
82 		return gtkStackSwitcher;
83 	}
84 
85 	/** the main Gtk struct as a void* */
86 	protected override void* getStruct()
87 	{
88 		return cast(void*)gtkStackSwitcher;
89 	}
90 
91 	/**
92 	 * Sets our main struct and passes it to the parent class.
93 	 */
94 	public this (GtkStackSwitcher* gtkStackSwitcher, bool ownedRef = false)
95 	{
96 		this.gtkStackSwitcher = gtkStackSwitcher;
97 		super(cast(GtkWidget*)gtkStackSwitcher, ownedRef);
98 	}
99 
100 	// add the Orientable capabilities
101 	mixin OrientableT!(GtkStackSwitcher);
102 
103 
104 	/** */
105 	public static GType getType()
106 	{
107 		return gtk_stack_switcher_get_type();
108 	}
109 
110 	/**
111 	 * Create a new `GtkStackSwitcher`.
112 	 *
113 	 * Returns: a new `GtkStackSwitcher`.
114 	 *
115 	 * Throws: ConstructionException GTK+ fails to create the object.
116 	 */
117 	public this()
118 	{
119 		auto __p = gtk_stack_switcher_new();
120 
121 		if(__p is null)
122 		{
123 			throw new ConstructionException("null returned by new");
124 		}
125 
126 		this(cast(GtkStackSwitcher*) __p);
127 	}
128 
129 	/**
130 	 * Retrieves the stack.
131 	 *
132 	 * Returns: the stack
133 	 */
134 	public Stack getStack()
135 	{
136 		auto __p = gtk_stack_switcher_get_stack(gtkStackSwitcher);
137 
138 		if(__p is null)
139 		{
140 			return null;
141 		}
142 
143 		return ObjectG.getDObject!(Stack)(cast(GtkStack*) __p);
144 	}
145 
146 	/**
147 	 * Sets the stack to control.
148 	 *
149 	 * Params:
150 	 *     stack = a `GtkStack`
151 	 */
152 	public void setStack(Stack stack)
153 	{
154 		gtk_stack_switcher_set_stack(gtkStackSwitcher, (stack is null) ? null : stack.getStackStruct());
155 	}
156 }